.\" Copyright (C) 2020  Matthew "strager" Glazar
.\" See end of file for extended copyright information.
.\" This file was generated using generate-man-pages.
.
.\" Manual page for the 'man' utility.
.
.
'\" t
.\"     Title: quick-lint-js
.\"    Author: [see the "AUTHOR(S)" section]
.\" Generator: Asciidoctor 2.0.17
.\"    Manual: \ \&
.\"    Source: quick-lint-js version ﻿ 2.4.2
.\"  Language: English
.\"
.TH "QUICK\-LINT\-JS" "1" "" "quick\-lint\-js version ﻿ 2.4.2" "\ \&"
.ie \n(.g .ds Aq \(aq
.el       .ds Aq '
.ss \n[.ss] 0
.nh
.ad l
.de URL
\fI\\$2\fP <\\$1>\\$3
..
.als MTO URL
.if \n[.g] \{\
.  mso www.tmac
.  am URL
.    ad l
.  .
.  am MTO
.    ad l
.  .
.  LINKSTYLE blue R < >
.\}
.SH "NAME"
quick-lint-js \- find bugs in JavaScript programs
.SH "SYNOPSIS"
.sp
\fBquick\-lint\-js\fP [\fB\-\-output\-format\fP=\fIformat\fP] [<options>] \fIfile\fP [\fIfile\fP...]
.br
\fBquick\-lint\-js\fP \fB\-\-lsp\-server\fP [<options>]
.SH "DESCRIPTION"
.sp
\fBquick\-lint\-js\fP reads JavaScript files and reports syntax errors and other bugs.
.sp
This command has two modes:
.sp
\fBquick\-lint\-js\fP [<options>] \fIfile\fP [\fIfile\fP...]
.RS 4
Batch mode (default).
Check the given files, and report errors to the terminal (standard error).
\fB\-\-output\-format\fP can be used to customize how errors look.
.RE
.sp
\fBquick\-lint\-js\fP \-\-lsp\-server
.RS 4
LSP server mode.
Start a Language Server Protocol server, communicating using standard input and standard output.
Use this mode to integrate with code editors supporting LSP.
.RE
.SH "OPTIONS"
.sp
\fB\-\-output\-format\fP=\fIformat\fP
.RS 4
Customize how errors are printed. \fIformat\fP is one of the following:
.sp
.RS 4
.ie n \{\
\h'-04'\(bu\h'+03'\c
.\}
.el \{\
.  sp -1
.  IP \(bu 2.3
.\}
\fBgnu\-like\fP (default): a human\-readable format similar to GCC.
.RE
.sp
.RS 4
.ie n \{\
\h'-04'\(bu\h'+03'\c
.\}
.el \{\
.  sp -1
.  IP \(bu 2.3
.\}
\fBvim\-qflist\-json\fP: machine\-readable JSON which can be given to Vim\(cqs \fIsetqflist\fP function.
.RE
.sp
.RS 4
.ie n \{\
\h'-04'\(bu\h'+03'\c
.\}
.el \{\
.  sp -1
.  IP \(bu 2.3
.\}
\fBemacs\-lisp\fP: Emacs Lisp association list format.
.RE
.sp
Incompatible with \fB\-\-lsp\-server\fP.
.RE
.sp
\fB\-\-diagnostic\-hyperlinks\fP=\fIwhen\fP
.RS 4
Control whether to hyperlink error codes or not.
This option is only used if \fB\-\-output\-format=gnu\-like\fP.
\fIwhen\fP is one of the following:
.sp
.RS 4
.ie n \{\
\h'-04'\(bu\h'+03'\c
.\}
.el \{\
.  sp -1
.  IP \(bu 2.3
.\}
\fBauto\fP (default): shows error codes as hyperlinks only if the error output is a terminal.
On Windows it behaves like \*(Aqnever\*(Aq.
.RE
.sp
.RS 4
.ie n \{\
\h'-04'\(bu\h'+03'\c
.\}
.el \{\
.  sp -1
.  IP \(bu 2.3
.\}
\fBalways\fP: always shows error codes as hyperlinks.
.RE
.sp
.RS 4
.ie n \{\
\h'-04'\(bu\h'+03'\c
.\}
.el \{\
.  sp -1
.  IP \(bu 2.3
.\}
\fBnever\fP: never shows error codes as hyperlinks.
.RE
.sp
Incompatible with \fB\-\-lsp\-server\fP.
.RE
.sp
\fB\-\-vim\-file\-bufnr\fP=\fInumber\fP
.RS 4
Set the \fIbufnr\fP property for errors printed with the \fB\-\-output\-format=vim\-qflist\-json\fP option.
.sp
\fB\-\-vim\-file\-bufnr\fP applies only to the next input file given in the command line.
Therefore, if multiple input files are given, \fB\-\-vim\-file\-bufnr\fP can be specified multiple times.
.RE
.sp
\fB\-\-path\-for\-config\-search\fP=\fIpath\fP
.RS 4
  For the following input file or \fB\-\-stdin\fP, use \fIpath\fP as the file\(cqs path when
searching for a configuration file (see \fBquick\-lint\-js.config\fP(5)).
.sp
\fIpath\fP must be a syntactically\-valid path.
\fIpath\fP does not need to exist in the filesystem.
.sp
\fB\-\-path\-for\-config\-search\fP applies only to the next input file given in the command line.
Therefore, if multiple input files are given, \fB\-\-path\-for\-config\-search\fP can be specified multiple times.
If \fB\-\-path\-for\-config\-search\fP is the last option, it has no effect.
.sp
Incompatible with \fB\-\-lsp\-server\fP.
.RE
.sp
\fB\-\-config\-file\fP=\fIfile\fP
.RS 4
Read configuration options from \fIfile\fP and apply them to input files which are given later in the command line.
See \fBquick\-lint\-js.config\fP(5) for the format of configuration files.
.sp
If \fB\-\-config\-file\fP is given twice, then the \fIfile\fP for the first \fB\-\-config\-file\fP option applies only to the input files between the two \fB\-\-config\-file\fP options, and the \fIfile\fP for the second \fB\-\-config\-file\fP option apples only to the input files after the second \fB\-\-config\-file\fP option.
See the EXAMPLE section for an example.
.sp
If \fB\-\-config\-file\fP is not given, \fBquick\-lint\-js\fP searches for a configuration file according to the rules specified in \fBquick\-lint\-js.config\fP(5).
.sp
Incompatible with \fB\-\-lsp\-server\fP.
.RE
.sp
\fB\-\-exit\-fail\-on\fP=\fIerrors\fP
.RS 4
Cause \fBquick\-lint\-js\fP to exit with a non\-zero exit code if any of the discovered errors is listed in \fIerrors\fP.
.sp
See the ERROR LISTS section for a description of the format for \fIerrors\fP.
.sp
Incompatible with \fB\-\-lsp\-server\fP.
.RE
.sp
\fB\-\-stdin\fP
.RS 4
Read standard input as a JavaScript file.
.sp
If neither \fB\-\-config\-file\fP nor \fB\-\-path\-for\-config\-search\fP is specified, an empty configuration file is assumed.
If \fB\-\-config\-file\fP is specified, \fIfile\fP is used for linting standard input.
If \fB\-\-path\-for\-config\-search\fP is specified and \fB\-\-config\-file\fP is not specified,
\fBquick\-lint\-js\fP searches for a configuration file according to the rules specified in \fBquick\-lint\-js.config\fP(5)
starting from \fB\-\-path\-for\-config\-search\fP\*(Aqs \fIpath\fP.
.sp
Incompatible with \fB\-\-lsp\-server\fP.
.RE
.sp
\fB\-\-lsp\fP, \fB\-\-lsp\-server\fP
.RS 4
Run \fBquick\-lint\-js\fP in LSP server mode.
Use this mode to integrate with code editors supporting LSP.
An editor can send LSP requests and notifications to \fBquick\-lint\-js\fP via standard input, and receive LSP responses and notifications from standard output.
.sp
Incompatible with \fB\-\-output\-format\fP.
.RE
.sp
\fB\-h\fP, \fB\-\-help\fP
.RS 4
Print a help message and exit.
.sp
The output format is not intended to be machine\-parsable and may change in the future.
.RE
.sp
\fB\-v\fP, \fB\-\-version\fP
.RS 4
Print version information and exit.
.sp
The output format is not intended to be machine\-parsable and may change in the future.
.RE
.SH "ERROR LISTS"
.sp
Some options, such as \fB\-\-exit\-fail\-on\fP, accept an error list.
An error list is a comma\-separated list of error code predicates and error category predicates.
.sp
An error lists can contain any number of include, exclude, and default predicates.
An include predicate is a \*(Aq+\*(Aq followed by the name of an error code or error category.
An exclude predicate is a \*(Aq\-\*(Aq followed by the name of an error code or error category.
An default predicate is the name of an error code or error category with no sigil.
.sp
An error list containing only include and exclude predicates modifies a default set of error codes.
The default set is decided by the option, but is often the set of all error codes.
An error list containing at least one default predicate empties the set of error codes, then treats the default predicates as if they were include predicates.
.sp
The order of predicates within an error list does not matter.
Included predicates are processed first, adding to the set of error codes.
Excluded predicates are processed second, removing from the set of error codes.
.sp
Error codes have the form \fBE0000\fP, where \fI0000\fP is four decimal digits (0\-9).
.sp
The following error categories are supported:
.sp
\fBall\fP
.RS 4
All error codes.
.RE
.sp
Example error lists:
.sp
\fBE0102,E0110\fP
.RS 4
Only error codes E0102 and E0110, excluding all other error codes.
.RE
.sp
\fB\-E0102\fP
.RS 4
The default set of error codes, except for error code E0102.
.RE
.sp
\fB+E0102\fP
.RS 4
The default set of error codes, and also error code E0102.
.RE
.sp
\fBall,\-E0102\fP
.RS 4
All error codes, except for error code E0102.
.RE
.sp
\fBE0100,\-E0100,+E0200\fP
.RS 4
Only error code E0200, excluding all other error codes.
.RE
.sp
\fB+E0200,\-E0100,E0100\fP
.RS 4
Only error code E0200, excluding all other error codes.
.RE
.SH "EXIT STATUS"
.sp
\fB0\fP
.RS 4
Batch mode: Linting succeeded with no errors or warnings.
.sp
LSP server mode: The LSP client requested that the server shut down.
This exit status may change in the future.
.RE
.sp
\fBnon\-0\fP
.RS 4
Batch mode: Linting failed with at least one error or warning, or at least one \fIfile\fP could not be opened and read.
.sp
The specific status code may change in the future.
.RE
.SH "ENVIRONMENT"
.sp
\fBLC_ALL\fP, \fBLC_MESSAGES\fP
.RS 4
Change the language used for error and warning messages.
For example, set \fBLC_ALL=en\fP to see messages written in United States English.
.RE
.SH "EXAMPLE"
.sp
To lint a file called \fIlib/index.js\fP, writing error messages to the terminal:
.RS 3
.ll -.6i
.sp
.if n .RS 4
.nf
.fam C
$ \fBquick\-lint\-js\fP lib/index.js
lib/index.js:1:20: error: variable used before declaration: language [E0058]
lib/index.js:2:7: note: variable declared here [E0058]
lib/index.js:3:1: error: assignment to const variable [E0003]
lib/index.js:1:7: note: const variable declared here [E0003]
lib/index.js:5:25: warning: use of undeclared variable: ocupation [E0057]
.fam
.fi
.if n .RE
.br
.RE
.ll
.sp
To lint three files, writing machine\-readable messages to \fI/tmp/vim\-qflist.json\fP:
.RS 3
.ll -.6i
.sp
.if n .RS 4
.nf
.fam C
$ \fBquick\-lint\-js\fP \-\-output\-format=vim\-qflist\-json \(rs
    \-\-vim\-bufnr=3 lib/pizza\-dough.js \(rs
    \-\-vim\-bufnr=4 lib/pizza\-sauce.js \(rs
    \-\-vim\-bufnr=6 lib/pineapple.js \(rs
    >/tmp/vim\-qflist.json
.fam
.fi
.if n .RE
.br
.RE
.ll
.sp
Errors for \fIlib/pizza\-dough.js\fP will include \fI"bufnr":3\fP in the output and errors for \fIlib/pineapple.js\fP will include \fI"bufnr":6\fP.
.sp
To lint a file called \fIbad.js\fP, but don\(cqt fail on use\-of\-undeclared\-variable errors:
.RS 3
.ll -.6i
.sp
.if n .RS 4
.nf
.fam C
$ \fBquick\-lint\-js\fP \-\-exit\-fail\-on=\-E0057 bad.js
bad.js:5:25: warning: use of undeclared variable: $ [E0057]
$ echo $?
0
.fam
.fi
.if n .RE
.br
.RE
.ll
.sp
To lint source files with a strict configuration file and lint test files with a lax configuration file:
.RS 3
.ll -.6i
.sp
.if n .RS 4
.nf
.fam C
$ \fBquick\-lint\-js\fP \(rs
    \-\-config\-file strict\-quick\-lint\-js.config src/index.js src/helpers.js \(rs
    \-\-config\-file lax\-quick\-lint\-js.config test/test\-app.js
.fam
.fi
.if n .RE
.br
.RE
.ll
.sp
To lint a temporary file, but use the configuration file of a project:
.RS 3
.ll -.6i
.sp
.if n .RS 4
.nf
.fam C
$ \fBquick\-lint\-js\fP \-\-path\-for\-config\-search=src/server.js /tmp/unsaved12m1uz.js
/tmp/unsaved12m1uz.js:12:5: warning: use of undeclared variable: document [E0057]
.fam
.fi
.if n .RE
.br
.RE
.ll
.SH "SEE ALSO"
.sp
\fBeslint\fP(1)
\fBquick\-lint\-js.config\fP(1)

.\" quick-lint-js finds bugs in JavaScript programs.
.\" Copyright (C) 2020  Matthew "strager" Glazar
.\"
.\" This file is part of quick-lint-js.
.\"
.\" quick-lint-js is free software: you can redistribute it and/or modify
.\" it under the terms of the GNU General Public License as published by
.\" the Free Software Foundation, either version 3 of the License, or
.\" (at your option) any later version.
.\"
.\" quick-lint-js is distributed in the hope that it will be useful,
.\" but WITHOUT ANY WARRANTY; without even the implied warranty of
.\" MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
.\" GNU General Public License for more details.
.\"
.\" You should have received a copy of the GNU General Public License
.\" along with quick-lint-js.  If not, see <https://www.gnu.org/licenses/>.
